#pragma once
#include "Object.h"
#include "Mesh.h"
#include "texture.hpp"

#include <glm\glm.hpp>
#include <glm\gtc\matrix_transform.hpp>
#include <gl\glfw.h>
#include <GLNew\glew.h>
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
#include <GLNew\glfw.h>
#include <map>
#include "ShadowMappingTechnique.h"
#include "DepthTechnique.h"


class Model :
	public Object
{
public:
	Model(char * name);
	Model(Mesh mesh, char * name);
	Model(char * meshFilePath, char * name);
	Model(char * meshFilePath, GLuint texture, char * name);
	Model(char * meshFilePath, char * texturePath, char * name);
	~Model(void);

	bool Init();
	void render(mat4 ProjectionMatrix, mat4 ViewMatrix);
	void renderToFrameBuffer();
	void setPosition(float x, float y, float z);
	glm::vec3 getPosition();
	int getModelId();

	void setDiffuseTexture(GLuint texture);

	virtual void debugRender();

private:
	Mesh modelMesh;
	glm::vec3 position;
	GLuint diffuseTexture;
	bool textureAvailable;
	int modelId;
	
	static std::map<int, glm::mat4> allDepthMVP;	// Saves all DepthMVP from every Model with its modelId(needed for shadow in "render()")
	static int currentModelId;

	ShadowMappingTechnique *m_shadowMappingTechnique;
	DepthTechnique *m_depthTechnique;
};

